layui.define(["jquery", "i18n", "element", "layer", "form", "rate", "table", "slider", "upload", "laydate", "dropdown", "colorpicker", "cascader", "content", "tags"], (function (exports) {
    "use strict";
    var $ = layui.jquery,
        i18n = layui.i18n,
        layer = layui.layer,
        form = layui.form,
        rate = layui.rate,
        table = layui.table,
        slider = layui.slider,
        element = layui.element,
        laydate = layui.laydate,
        cascader = layui.cascader,
        upload = layui.upload,
        content = layui.content,
        colorpicker = layui.colorpicker,
        TABFILTER = "swiftadmin-tabs",
        BODY = ".layui-body",
        LAYOUTBODY = ".layui-layout-body",
        LAYOUTADMIN = ".layui-layout-admin",
        TABS = BODY + ">.layui-tab",
        FLEXIBLEID = "flexible",
        MENUFILTER = "lay-side-menu",
        LAYTOPMENU = "lay-top-menu",
        LAYSIDESHRINK = "layadmin-side-shrink",
        LAYSIDESPREAD = "layadmin-side-spread-sm",
        ICONSHRINKRIGHT = "layui-icon-shrink-right",
        ICONSPREADLEFT = "layui-icon-spread-left",
        STR_EMPTY = "",
        BODYSHADE = '<div class="layadmin-body-shade" sa-event="shade"></div>',
        BODYSHADECLASS = ".layadmin-body-shade",
        LAYERCONTENT = ".layui-layer-content",
        admin = {
            options: {
                tplName: 'zf3',      // 数据标识
                version: '1.2.0',           // 版本
                moreLabel: false,            // 是否开启多标签
                cacheTab: false,             // 缓存多标签
                maxTabNum: 1000,              // 最大打开标签
                TabLists: [],               // 标签缓存
                style: 'dark',              // 样式
                theme: 'blue',              // 皮肤
                layout: 'left',             // 布局操作
                fluid: true,                // 是否内容铺满
                openHeader: true,
                openFooter: false,
            },
            getSpinningHtml: function () {
                return ['<div id="loading">', '<div class="loader">', '<div class="ant-spin ant-spin-spinning" >', '<span class="ant-spin-dot ant-spin-dot-spin">', '<i class="ant-spin-dot-item"></i>', '<i class="ant-spin-dot-item"></i>', '<i class="ant-spin-dot-item"></i>', '<i class="ant-spin-dot-item"></i>', " </span></div></div></div>"].join("")
            },
            showLoading: function (a) {
                var e = admin.getSpinningHtml(),
                    i = $(a).children("#loading");
                i.length <= 0 ? $(a).append(e) : i.show()
            },
            removeLoading: function (a) {
                if (void 0 === typeof a && (a = "body"), "master" === a) {
                    var e = $(LAYOUTBODY).children("#loading");
                    e && e.fadeOut(800),
                        e && e.remove(),
                        $(LAYOUTADMIN).show(300)
                } else $(a).next("#loading").fadeOut(800)
            },
            setConfig: function (a, e) {
                var i = admin.options.tplName + "_session";
                null != e && "undefined" !== e ? layui.sessionData(i, {
                    key: a,
                    value: e
                }) : layui.sessionData(i, {
                    key: a,
                    remove: !0
                })
            },
            getConfig: function (a) {
                var e = admin.options.tplName + "_session",
                    i = layui.sessionData(e);
                return !!i && i[a]
            },
            setStorage: function (a, e) {
                var i = admin.options.tplName + "_system";
                null != e && "undefined" !== e ? layui.data(i, {
                    key: a,
                    value: e
                }) : layui.data(i, {
                    key: a,
                    remove: !0
                })
            },
            getStorage: function (a) {
                var e = admin.options.tplName + "_system",
                    i = layui.data(e);
                return !!i && i[a]
            },
            setBreadHtml: function () {
                $(".layui-breadcrumb-header").length <= 0 && ($(".layui-nav-head").before('<div class="layui-breadcrumb-header layui-breadcrumb" lay-separator="/">      <a lay-href="#">主页</a>      <span class="breadcrumb">          <a lay-href="#">Dashboard</a>      </span>   </div>'), $(".layui-nav-head").hide()),
                    admin.screen() < 2 && $(".layui-breadcrumb-header").hide()
            },
            setBreadcrumb: function (a, e) {
                for (var i = STR_EMPTY,
                    t = $('.layui-nav-tree li [lay-href="' + a + '"]'), n = $(t).parents().find(".layui-nav-item"), l = 0; l < n.length; l++) {
                    if ($(n[l]).find('[lay-href="' + a + '"]').length) i += '<a lay-href="#" >' + $(n[l]).find("a:first").text() + '</a><span lay-separator="">/</span>'
                }
                i += '<a lay-href="' + a + '">' + e + "</a>",
                    $(".breadcrumb").html(i)
            },
            fullScreen: function () {
                var a = document.documentElement,
                    e = a.requestFullScreen || a.webkitRequestFullScreen || a.mozRequestFullScreen || a.msRequestFullscreen;
                void 0 !== e && e && e.call(a)
            },
            exitScreen: function () {
                document.exitFullscreen ? document.exitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitCancelFullScreen ? document.webkitCancelFullScreen() : document.msExitFullscreen && document.msExitFullscreen()
            },
            rollPage: function (a, e) {
                var i = $(TABS + ">.layui-tab-title"),
                    t = i.scrollLeft();
                if ("left" === a) i.animate({
                    scrollLeft: t - 120
                },
                    100);
                else if ("auto" === a) {
                    var n = 0;
                    i.children("li").each((function () {
                        if ($(this).hasClass("layui-this")) return !1;
                        n += $(this).outerWidth()
                    })),
                        i.animate({
                            scrollLeft: n - 120
                        },
                            100)
                } else i.animate({
                    scrollLeft: t + 120
                },
                    100)
            },
            refresh: function (a) {
                if (null == a) return !1;
                var e = $('iframe[lay-id="' + a + '"]');
                if (!admin.options.moreLabel) return $("#loading").show(),
                    e[0].contentWindow.location.reload(!0);
                e = $(TABS + " .layui-tab-item").find("iframe");
                for (let i = 0; i < e.length; i++) {
                    $(e[i]).attr("lay-id") == a && (e[i].contentWindow.location.reload(!0), $(e[i]).next("#loading").css({
                        overflow: "hidden",
                        display: "block"
                    }))
                }
            },
            globalStyleCss: function () {
                return ".layadmin-setTheme-side, .layui-side-menu,.layui-layout-admin .layui-logo,.layui-nav-itemed>.layui-nav-child{",
                    "background-color: #fff!important;",
                    "color: #000;}",
                    ".layui-side-menu .layui-nav .layui-nav-item>a,",
                    ".layui-nav-tree .layui-nav-child,",
                    ".layui-nav-itemed>a, .layui-nav-tree .layui-nav-title a, .layui-nav-tree .layui-nav-title a:hover,",
                    ".layui-side .layui-logo h1,",
                    ".layui-side-menu .layui-nav .layui-nav-item>a, .layui-nav-tree .layui-nav-child a,",
                    ".layui-layout-admin .layui-side .layui-nav .layui-other-set {",
                    "color: #000!important;}",
                    ".layui-nav-tree .layui-nav-child, .layui-nav-tree .layui-nav-child a:hover {color: #1890ff!important;}",
                    ".layui-nav-tree .layui-nav-child .layui-this a { color: #fff!important;}",
                    ".layui-nav .layui-nav-more { border-top-color: rgba(0,0,0,.7);}",
                    ".layui-nav .layui-nav-mored, .layui-nav-itemed>a .layui-nav-more {border-color: transparent transparent #000;}",
                    ".layadmin-side-shrink .layui-side .layui-nav .layadmin-nav-hover>.layui-nav-child:before{background-color: #fff; }",
                    ".layadmin-side-shrink .layui-side-menu .layui-nav>.layui-nav-itemed>a{background: #f2f2f2;}",
                    ".layui-nav-tree .layui-nav-child dd.layui-this, .layui-nav-tree .layui-nav-child dd.layui-this a, .layui-nav-tree .layui-this,",
                    ".layui-nav-tree .layui-this>a {background-color: #e6f7ff!important;border-right: 1px solid #1890ff!important;color: #1890ff!important;}",
                    "</style>",
                    '<style id="style-light">.layadmin-setTheme-side, .layui-side-menu,.layui-layout-admin .layui-logo,.layui-nav-itemed>.layui-nav-child{background-color: #fff!important;color: #000;}.layui-side-menu .layui-nav .layui-nav-item>a,.layui-nav-tree .layui-nav-child,.layui-nav-itemed>a, .layui-nav-tree .layui-nav-title a, .layui-nav-tree .layui-nav-title a:hover,.layui-side .layui-logo h1,.layui-side-menu .layui-nav .layui-nav-item>a, .layui-nav-tree .layui-nav-child a,.layui-layout-admin .layui-side .layui-nav .layui-other-set {color: #000!important;}.layui-nav-tree .layui-nav-child, .layui-nav-tree .layui-nav-child a:hover {color: #1890ff!important;}.layui-nav-tree .layui-nav-child .layui-this a { color: #fff!important;}.layui-nav .layui-nav-more { border-top-color: rgba(0,0,0,.7);}.layui-nav .layui-nav-mored, .layui-nav-itemed>a .layui-nav-more {border-color: transparent transparent #000;}.layadmin-side-shrink .layui-side .layui-nav .layadmin-nav-hover>.layui-nav-child:before{background-color: #fff; }.layadmin-side-shrink .layui-side-menu .layui-nav>.layui-nav-itemed>a{background: #f2f2f2;}.layui-nav-tree .layui-nav-child dd.layui-this, .layui-nav-tree .layui-nav-child dd.layui-this a, .layui-nav-tree .layui-this,.layui-nav-tree .layui-this>a {background-color: #e6f7ff!important;border-right: 1px solid #1890ff!important;color: #1890ff!important;}</style>'
            },
            setTheme: function () {
                var a = admin.getStorage("theme") || admin.options.theme;
                if (admin.getStorage("moreLabel")) {
                    var e = top.layui.$(TABS + " .layui-tab-item").find("iframe");
                    for (let i = 0; i < e.length; i++) $(e[i]).contents().find("body").attr("id", a)
                } else top.layui.$("iframe").contents().find("body").attr("id", a);
                top.layui.$("body").attr("id", a)
            },
            setlayFluid: function () {
                var a = admin.getStorage("fluid"),
                    e = '<style id="lay-fluid">.layui-fluid{max-width:1200px;}</style>';
                if (void 0 === a && (a = admin.options.fluid), admin.options.moreLabel) {
                    var t = top.layui.$(TABS + " .layui-tab-item").find("iframe");
                    for (let i = 0; i < t.length; i++) !1 !== a ? $(t[i]).contents().find("#lay-fluid").remove() : $(t[i]).contents().find("head").find("#lay-fluid").length <= 0 && $(t[i]).contents().find("head").append(e)
                } else !1 !== a ? top.layui.$("iframe").contents().find("#lay-fluid").remove() : $(t[i]).contents().find("head").find("#lay-fluid").length <= 0 && top.layui.$("iframe").contents().find("head").append(e)
            },
            setDropStyle: function () {
                var a = admin.getStorage("dropstyle");
                void 0 !== a && (top.layui.$(".layui-nav-tree").removeClass("arrow1 arrow2 arrow3"), top.layui.$(".layui-nav-tree").addClass(a))
            },
            setPageHeaderFooter: function (a = "header") {
                if ("header" == a) {
                    var e = admin.getStorage("openHeader"); !1 === e ? (top.layui.$(".layui-header,.layui-logo").hide(), top.layui.$(".layui-nav-tree,.layui-body").css({
                        top: "0px",
                        "margin-top": "0px"
                    })) : !0 === e && (top.layui.$(".layui-header,.layui-logo").show(), top.layui.$(".layui-nav-tree").css("margin-top", "60px"), top.layui.$(".layui-body").css("top", "50px"))
                } else {
                    var i = admin.getStorage("openFooter"); !1 === i ? top.layui.$(".layui-footer").hide() : !0 === i && top.layui.$(".layui-footer").show()
                }
            },
            changeI18n: function (a) {
                i18n.render(a)
            },
            screen: function () {
                var a = $(window).width();
                return a > 1200 ? 3 : a > 992 ? 2 : a > 768 ? 1 : 0
            },
            flexible: function (a) {
                var e = $(LAYOUTBODY),
                    i = $("#" + FLEXIBLEID),
                    t = admin.screen();
                a ? (i.removeClass(ICONSPREADLEFT).addClass(ICONSHRINKRIGHT), t < 2 ? e.addClass(LAYSIDESPREAD) : e.removeClass(LAYSIDESPREAD), e.removeClass(LAYSIDESHRINK), $(BODYSHADECLASS).length <= 0 && $(LAYOUTADMIN).append(BODYSHADE)) : (i.removeClass(ICONSHRINKRIGHT).addClass(ICONSPREADLEFT), t < 2 ? e.removeClass(LAYSIDESHRINK) : e.addClass(LAYSIDESHRINK), e.removeClass(LAYSIDESPREAD), $(LAYOUTADMIN).removeClass(BODYSHADE))
            }
        };
    if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
        admin.setStorage('moreLabel', false);
    }else{
        admin.setStorage('moreLabel', true);
    }
    admin.utils = {
        filesuffix: function (a, e = 6) {
            if (void 0 !== a) {
                var i = a.substring(a.lastIndexOf(".") + 1, a.length);
                i.length >= length && i.substring(0, length);
                var t = [];
                for (const a in i) a >= 3 ? t[a - 3] += i[a].charCodeAt() : t[a] = i[a].charCodeAt();
                var n = ['<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">', '<path style="fill:#E2E5E7;" d="M128,0c-17.6,0-32,14.4-32,32v448c0,17.6,14.4,32,32,32h320c17.6,0,32-14.4,32-32V128L352,0H128z"/>', '<path style="fill:#B0B7BD;" d="M384,128h96L352,0v96C352,113.6,366.4,128,384,128z"/>', '<polygon style="fill:#CAD1D8;" points="480,224 384,128 480,128 "/>', '<path style="fill:rgb(' + t.join(",") + ');" d="M416,416c0,8.8-7.2,16-16,16H48c-8.8,0-16-7.2-16-16V256c0-8.8,7.2-16,16-16h352c8.8,0,16,7.2,16,16 V416z"/>', '<path style="fill:#CAD1D8;" d="M400,432H96v16h304c8.8,0,16-7.2,16-16v-16C416,424.8,408.8,432,400,432z"/>', '<g><text><tspan x="220" y="380" font-size="124" font-family="Verdana, Helvetica, Arial, sans-serif" fill="white" text-anchor="middle">' + i + "</tspan></text></g>", "</svg>"].join("");
                return "data:image/svg+xml;base64," + window.btoa(n)
            }
        },
        escape: function (a) {
            return String(a || "").replace(/&(?!#?[a-zA-Z0-9]+;)/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/'/g, "&#39;").replace(/"/g, "&quot;")
        },
        getPath: function () {
            var a = document.currentScript ? document.currentScript.src : function () {
                for (var a, e = document.scripts,
                    i = e.length - 1,
                    t = i; t > 0; t--) if ("interactive" === e[t].readyState) {
                        a = e[t].src;
                        break
                    }
                return a || e[i].src
            }();
            return a.substring(0, a.lastIndexOf("/") + 1)
        }
    },
        admin.event = {
            flexible: function () {
                var a = $("#" + FLEXIBLEID).hasClass(ICONSPREADLEFT);
                admin.flexible(a ? "open" : null)
            },
            shade: function () {
                admin.flexible()
            },
            refresh: function () {
                admin.refresh(admin.getConfig("activeTab"))
            },
            back: function () { },
            theme: function () {
                var a = $(this).data("url");
                admin.event.popupRight({
                    id: "layer-theme",
                    type: 2,
                    content: a
                })
            },
            message: function () {
                var a = $(this),
                    e = a.data("url");
                admin.event.flowOpen({
                    id: "layer-msg",
                    type: 2,
                    area: ["336px", "390px"],
                    content: e
                },
                    a)
            },
            pwd: function () {
                var a = $(this).data("url");
                admin.event.pupupOpen({
                    id: "layer-pwd",
                    type: 2,
                    shade: 0,
                    title: "🔑  修改密码",
                    area: ["385px", "295px"],
                    content: a
                })
            },
            clear: function () { },
            logout: function (a) {
                var e = $(this).data("url");
                layui.layer.confirm("确定要退出登录吗？", {
                    title: "提示"
                },
                    (function () {
                        location.replace(e)
                    }))
            },
            flowOpen: function (a, e) {
                if (void 0 === e) return layer.msg(i18n.prop("未定义"), "info");
                var i = 0,
                    t = e[0].getBoundingClientRect();
                null == a.title && (a.title = !1, a.closeBtn = !1),
                    a.shadeClose = !0,
                    a.area || (a.area = "336px"),
                    i = a.area instanceof Array ? a.area[0] : a.area,
                    i = parseInt(i),
                    a.anim || (a.anim = 5),
                    a.resize = null != a.resize && a.resize,
                    a.shade = null != a.shade ? a.shade : .1;
                var n = t.height,
                    l = (e.innerWidth(), e.width(), t.left + t.width / 2 - i / 2);
                return a.offset || (a.offset = [n, l]),
                    layer.open(a)
            },
            pupupOpen: function (a) {
                return null == a.title && (a.title = !1, a.closeBtn = !1),
                    a.offset || ($(window).width() < 768 ? a.offset = "15px" : window == top ? a.offset = "25%" : a.offset = "20%"),
                    a.resize = null != a.resize && a.resize,
                    a.shade = null != a.shade ? a.shade : .1,
                    layer.open(a)
            },
            pupupTop: function (a) {
                return (a = admin.event.popupAnim(a)).offset = a.offset || (a.offset = "t"),
                    admin.event.pupupOpen(a)
            },
            pupupDown: function (a) {
                return (a = admin.event.popupAnim(a)).offset = a.offset || (a.offset = "d"),
                    admin.event.pupupOpen(a)
            },
            pupupLeft: function (a) {
                return (a = admin.event.popupAnim(a)).offset = a.offset || (a.offset = "l"),
                    admin.event.pupupOpen(a)
            },
            popupRight: function (a) {
                return (a = admin.event.popupAnim(a)).offset = a.offset || (a.offset = "r"),
                    admin.event.pupupOpen(a)
            },
            popupAnim: function (a) {
                return a.anim = -1,
                    a.shadeClose = !0,
                    a.area || (a.area = "336px"),
                    a.skin || (a.skin = "layui-anim layui-anim-rl layui-layer-adminRight"),
                    a.move = !1,
                    null == a.fixed && (a.fixed = !0),
                    a
            },
            fullscreen: function (a) {
                var e = "layui-icon-screen-full",
                    i = "layui-icon-screen-restore",
                    t = a.children("i");
                t.hasClass(e) ? (t.addClass(i).removeClass(e), admin.fullScreen()) : (admin.exitScreen(), t.addClass(e).removeClass(i))
            },
            leftPage: function () {
                admin.rollPage("left")
            },
            rightPage: function () {
                admin.rollPage()
            },
            tabs: function () {
                var a = $(this).data("url"),
                    e = $(this).data("title");
                e || (e = $(this).text()),
                    top.layui && top.layui.admin ? top.layui.admin.createElementTabs({
                        id: a,
                        title: e || "",
                        url: a
                    }) : location.href = a
            },
            closeThisTabs: function (a) {
                if (null != a && "object" == typeof a && (a = admin.getConfig("activeTab")), admin.getConfig("TabLists")[0].id === a) return layer.info(i18n.prop("请不要关闭主页")),
                    !1;
                element.tabDelete(TABFILTER, a)
            },
            closeOtherTabs: function (a) {
                for (var e = admin.getConfig("TabLists"), i = e.length - 1; i >= 1; i--) e[i].id !== a && element.tabDelete(TABFILTER, e[i].id);
                admin.setConfig("activeTab", a)
            },
            closeAllTabs: function () {
                let a = admin.getConfig("TabLists"),
                    e = a.length - 1;
                for (; e >= 1; e--) element.tabDelete(TABFILTER, a[e].id)
            },
            closeDialog: function (a) {
                if (void 0 === $(a).parents(".layui-layer").attr("type")) parent.layer.close(parent.layer.getFrameIndex(window.name));
                else {
                    var e = $(a).parents(".layui-layer").attr("id").substring(11);
                    layer.close(e)
                }
            },
            closePageDialog: function () {
                admin.event.closeDialog(this)
            },
            ajax: function (a, e, i = !1) {
                var t = [];
                $.ajax({
                    url: a,
                    type: "post",
                    data: e,
                    async: i,
                    success: function (a) {
                        t = a
                    }
                });
                try {
                    return "object" != typeof t ? JSON.parse(t) : t
                } catch (a) { }
            },
            open: function (clickObj, tableThis, mergeOptions) {
                var syarea = 'auto';
                if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
                    syarea = "95%,95%";
                } else {
                    syarea = clickObj.data("area") || "auto";
                }
                var options = {
                    url: admin._validauthURL(clickObj),
                    type: clickObj.data("type") || 2,
                    area: syarea,
                    offset: clickObj.data("offset") || !1,
                    title: clickObj.data("title") || !1,
                    maxmin: clickObj.data("maxmin") || !1,
                    auto: clickObj.data("auto") || void 0,
                    scrollbar: clickObj.data("scrollbar") || void 0,
                    disableform: clickObj.data("disable") || !1,
                    callback: clickObj.attr("callback") || void 0
                };
                options.id = options.url.replace(/[^0-9|a-z|A-Z]/i, ""),
                    options.url = options.url.replace(/\s+/g, "");
                var firstURL = options.url.substring(0, 1);
                if (firstURL && "#" == firstURL) {
                    if (options.type = 1, options.url = $(options.url).html(), void 0 !== tableThis) {
                        var htmls = $(options.url);
                        $(htmls).find("*[data-disabled]").addClass("layui-disabled").attr("disabled", ""),
                            options.url = htmls.prop("outerHTML")
                    }
                } else options.url = options.url;
                if (0 == options.offset && "auto" !== options.area) {
                    var height = options.area.split(",");
                    if (void 0 !== height[1]) {
                        height = height[1];
                        var offsetHeight = document.documentElement.clientHeight; - 1 !== height.indexOf("px") ? height = parseInt(height) : (height = parseInt(height), height = offsetHeight * (height / 100)),
                            options.offset = height >= offsetHeight ? 0 : (offsetHeight - height) / 3
                    }
                } else options.offset = options.offset || "15%";
                "auto" !== options.area && (options.area = options.area.split(",")),
                    "auto" !== options.area && "100%" == options.area[0] && (options.offset = 0, "object" == typeof options.url && (options.url = options.url[0])),
                    void 0 !== mergeOptions && (options = $.extend(options, mergeOptions)),
                    layer.open({
                        type: options.type,
                        area: options.area,
                        title: options.title,
                        offset: options.offset,
                        maxmin: options.maxmin,
                        shadeClose: !1,
                        scrollbar: !1,
                        content: options.url,
                        success: function (layero, index) {
                            if (options.type <= 1) {
                                "auto" == options.area && layer.iframeAuto(index),
                                    $(layero).children(LAYERCONTENT).css("overflow", "visible"),
                                    void 0 === tableThis || options.disableform || form.val(options.id, tableThis.data);
                                const components = admin.components;
                                for (const key in components) options.url.match("lay-" + key) && eval(components[key])();
                                if (form.render(), void 0 !== options.callback) return admin.callbackfunc(clickObj, {
                                    tableThis: tableThis,
                                    layero: layero,
                                    index: index
                                });
                                form.on("submit(submitPage)", (function (a) {
                                    var e = $(this),
                                        i = $(e).data("reload") || !1,
                                        t = $(e).parents("form").attr("action"),
                                        n = tableThis ? "edit" : "add";
                                    console.log(i);
                                    return t || (t = e.attr("lay-" + n)),
                                        void 0 === t && (t = _global_.app + "/" + _global_.controller + "/" + n),
                                        e.attr("disabled", !0),
                                        $.ajax({
                                            url: t,
                                            type: "post",
                                            dataType: "json",
                                            data: a.field,
                                            success: function (t) {
                                                for (var n in a.field) {
                                                    0 !== $(clickObj).parents("tr").find("*[data-field=" + n + "]").find("*[lay-skin]").length && delete a.field[n]
                                                }
                                                if (200 == t.code) {
                                                    switch (i) {
                                                        case "top":
                                                            top.location.reload();
                                                            break;
                                                        case "parent":
                                                            parent.location.reload();
                                                            break;
                                                        case "self":
                                                            location.reload();
                                                            break;
                                                        default:
                                                    }
                                                    tableThis ? tableThis.update(JSON.parse(JSON.stringify(a.field))) : table.reload("lay-tableList"),
                                                        layer.msg(t.msg),
                                                        admin.event.closeDialog(e)
                                                } else layer.error(t.msg),
                                                    e.attr("disabled", !1)
                                            },
                                            error: function (a) {
                                                e.attr("disabled", !1),
                                                    layer.msg(i18n.prop("访问方法失败"), "error")
                                            }
                                        }),
                                        !1
                                }))
                            }
                        }
                    })
            },
            request: function (a, e, i, t) {
                var n = {
                    url: admin._validauthURL(a),
                    type: a.data("type") || "post",
                    dataType: a.data("dataType") || "json",
                    timeout: a.data("timeout") || "6000",
                    confirm: a.data("confirm"),
                    reload: a.data("reload"),
                    tableId: a.data("table") || a.attr("batch"),
                    async: a.data("async") || !0
                },
                    l = function (a) {
                        return "undefiend" != typeof t && (a = $.extend({},
                            a, t)),
                            $.ajax({
                                url: a.url,
                                type: a.type,
                                dataType: a.dataType,
                                timeout: a.timeout,
                                data: e,
                                async: a.async,
                                success: function (e) {
                                    if (200 === e.code) {
                                        if (void 0 !== i && "function" == typeof i.success) return i.success(e);
                                        switch (a.reload) {
                                            case "top":
                                                top.location.reload();
                                                break;
                                            case "parent":
                                                parent.location.reload();
                                                break;
                                            case "self":
                                                location.reload();
                                                break;
                                            default:
                                        }
                                        void 0 !== a.tableId && table.reload(a.tableId),
                                            layer.msg(e.msg)
                                    } else {
                                        if (void 0 !== i && "function" == typeof i.error) return i.error(e);
                                        layer.error(e.msg)
                                    }
                                },
                                error: function (a) {
                                    layer.msg(i18n.prop("访问方法失败"), "error")
                                }
                            }),
                            a
                    };
                if (void 0 === n.confirm) return l(n);
                n.confirm = n.confirm || "确定执行此操作吗?",
                    layer.confirm(n.confirm, (function (a) {
                        return layer.close(a),
                            l(n)
                    }), (function (a) {
                        return layer.close(a),
                            !1
                    }))
            }
        },
        admin.callback = {},
        admin.callbackfunc = function (clickThis, collection, before) {
            let funcObj = before ? clickThis.attr("callbefore") : clickThis.attr("callback");
            if (void 0 !== funcObj) return funcObj = "admin.callback." + funcObj,
                "function" == typeof eval(funcObj) ? eval(funcObj)(clickThis, collection) : (layer.msg(i18n.prop("回调函数错误"), "error"), !1)
        },
        admin._validauthURL = function (a, e) {
            var i = $(a).attr("data-url");
            if (void 0 === i) throw layer.msg(i18n.prop("URL未定义"), "error"),
                "lay-ajax url undefined";
            if (- 1 !== i.indexOf(_global_.app)) {
                var t = i.replace(".html", ""),
                    n = (t = t.substring(1)).substring(0, t.indexOf("/")); - 1 != t.indexOf(".php") && (n = (n = t.replace(n, "").substring(1)).substring(0, n.indexOf("/")));
                var l = t.substring(t.indexOf(n) + n.length + 1); - 1 !== l.indexOf("/") ? l = l.substring(0, l.indexOf("/")) : -1 !== l.indexOf("?") && (l = l.substring(0, l.indexOf("?"))),
                    t = n + ":" + l;
                let a,
                    e = function (i) {
                        for (let l in i) {
                            var n = i[l];
                            t == n.alias && (a = !0),
                                void 0 !== typeof n.children && e(n.children)
                        }
                        return a || !1
                    },
                    o = admin.getConfig("router");
                if (void 0 !== typeof o.supersAdmin && !1 === o.supersAdmin && -1 === i.indexOf("://") && !e(o.authorities)) throw layer.msg(i18n.prop("无权操作"), "error"),
                    "没有权限"
            }
            return i
        },
        admin.components = {
            datetime: function (a) {
                $("*[lay-datetime]").each((function (a, e) {
                    console.log($(e).data("type"));
                    var i = $(e).data("type") || "datetime",
                        t = $(e).data("format") || "yyyy-MM-dd HH:mm:ss",
                        n = $(e).val() || "",
                        l = $(e).data("range") || !1,
                        o = $(e).data("maxvalue") || "2222-12-31",
                        r = $(e).data("minvalue") || "1930-01-01";
                    laydate.render({
                        elem: this,
                        type: i,
                        range: l,
                        max: o,
                        min: r,
                        value: n,
                        format: t,
                        done: function (a, e, i) { }
                    })
                }))
            },
            slider: function (a) {
                layui.each($("*[lay-slider]"), (function (a, e) {
                    var i = $(this),
                        t = i.data("type") || "default",
                        n = i.data("min") || 0,
                        l = i.data("max") || 100,
                        o = i.data("theme") || "#1890ff",
                        r = i.data("step") || 1,
                        s = i.data("input") || !1,
                        d = i.data("showstep") || !1,
                        u = $(e).attr("lay-slider"),
                        c = $("input[name=" + u + "]").val() || i.data("default");
                    slider.render({
                        elem: e,
                        type: t,
                        min: n,
                        max: l,
                        step: r,
                        showstep: d,
                        theme: o,
                        input: s,
                        value: c,
                        change: function (a) {
                            (a <= n || isNaN(a)) && (a = n),
                                $("input[name=" + u + "]").val(a)
                        }
                    })
                }))
            },
            rate: function (a) {
                layui.each($("*[lay-rate]"), (function (a, e) {
                    var i = $(this),
                        t = i.data("url") || void 0,
                        n = (i.data("ids"), i.data("theme") || "#1890ff"),
                        l = i.data("length") || 5,
                        o = i.data("half") || !1,
                        r = i.data("readonly") || !1,
                        s = $(e).attr("lay-rate"),
                        d = $("." + s),
                        u = d.val() || i.data("value");
                    rate.render({
                        elem: e,
                        half: o,
                        length: l,
                        theme: n,
                        readonly: r,
                        value: u,
                        choose: function (a) {
                            void 0 !== t || d.val(a)
                        }
                    })
                }))
            },
            tips: function (a) {
                $(document).on("mouseenter", "*[lay-tips]", (function () {
                    var a = $(this).attr("lay-tips"),
                        e = $(this).data("offset") || 1,
                        i = $(this).data("color") || "#000";
                    layer.tips(a, this, {
                        time: -1,
                        tips: [e, i],
                        area: ["auto", "auto"]
                    })
                })).on("mouseleave", "*[lay-tips]", (function () {
                    layer.closeAll("tips")
                }))
            },
            colorpicker: function (a) {
                $("*[lay-colorpicker]").each((function (a, e) {
                    var i = $(e).attr("lay-colorpicker"),
                        t = $("." + i).val() || $(i).data("value");
                    colorpicker.render({
                        elem: this,
                        color: t,
                        predefine: !0,
                        alpha: !0,
                        done: function (a) {
                            $("." + i).val(a)
                        }
                    })
                }))
            },
            upload: function (a) {
                layui.each($("*[lay-upload]"), (function (a, e) {
                    var i = $(this),
                        t = $(e).attr("lay-upload") || void 0,
                        n = $(e).data("url") || _global_.app + "/base/upload_img",
                        l = $(e).data("type") || "normal",
                        o = $(e).data("size") || 102400,
                        r = ($(e).data("accept"), $(e).data("multiple") || !1),
                        s = "undefined" != typeof _upload_chunkSize ? _upload_chunkSize : "2097152",
                        d = $(e).attr("callback") || void 0,
                        u = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice,
                        c = {
                            normal: function (a, e) {
                                $("input." + e).prop("value", a.url),
                                    $("img." + e).prop("src", a.url)
                            },
                            images: function (a, i) {
                                var t = $("img." + i);
                                t.prop("src", a.url),
                                    t.parent("div").removeClass("layui-hide"),
                                    $("input." + i).val(a.url),
                                    $(e).find("p,i,hr").addClass("layui-hide")
                            },
                            multiple: function (a, i) {
                                var t = $(".layui-imagesbox .layui-input-inline");
                                t = t.length ? t.length - 1 : 0;
                                var n = '<div class="layui-input-inline">';
                                n += '<img src="' + a.url + '" >',
                                    n += '<input type="text" name="' + i + "[" + t + '][src]" class="layui-hide" value="' + a.url + '">',
                                    n += '<input type="text" name="' + i + "[" + t + '][title]" class="layui-input" placeholder="图片简介">',
                                    n += '<span class="layui-badge layui-badge-red" onclick="layui.$(this).parent().remove();">删除</span></div>',
                                    $(e).parent().before(n)
                            }
                        };
                    layui.upload.render({
                        elem: e,
                        url: n,
                        method: "post",
                        size: o,
                        auto: !1,
                        accept: "file",
                        multiple: r,
                        choose: function (a) {
                            var e = this,
                                i = this.files = a.pushFile();
                            for (var t in i) {
                                var n = i[t];
                                if (n.size <= s) a.upload(t, n),
                                    delete i[t];
                                else {
                                    var l = n.lastModified + "-" + n.size,
                                        o = Math.ceil(n.size / s),
                                        r = /\.([0-9A-z]+)$/.exec(n.name)[1];
                                    admin.options[l] = {
                                        obj: a,
                                        file: n,
                                        othis: e,
                                        files: i,
                                        index: t
                                    };
                                    var d = layui.data(l).chunkList;
                                    if (void 0 === d) {
                                        d = [];
                                        for (var c = 0; c < o; c++) {
                                            var y = {
                                                state: !1,
                                                data: {
                                                    index: c,
                                                    chunkCount: o,
                                                    source: n.name,
                                                    fileExt: r,
                                                    fileSize: n.size,
                                                    mimeType: n.type,
                                                    chunkId: l,
                                                    chunkName: l + "-" + c + "." + r
                                                }
                                            };
                                            d.push(y)
                                        }
                                        layui.data(l, {
                                            key: "chunkList",
                                            value: d
                                        })
                                    }
                                    var f = "undefined";
                                    for (var m in d) if (!1 === d[m].state) {
                                        f = m;
                                        break
                                    }
                                    if ("undefined" === f) return layui.data(l, null),
                                        layer.error("数据读取异常");
                                    e.data = d[f].data;
                                    var p = f * s,
                                        h = Math.min(n.size, p + s);
                                    a.upload(t, u.call(n, p, h), e.data.source)
                                }
                            }
                        },
                        before: function (a) {
                            i.prop("disabled", !0)
                        },
                        done: function (a, e, n) {
                            if (i.prop("disabled", !1), void 0 !== d) return admin.callbackfunc(this.item, {
                                res: a,
                                index: e,
                                file: n
                            });
                            if (void 0 !== a.index && void 0 !== a.chunkId) {
                                if (200 !== a.code) return layer.closeAll(),
                                    layer.error(a.msg);
                                e = a.index;
                                var o = a.chunkId,
                                    r = layui.data(o).chunkList;
                                if (void 0 === r) return layui.data(o, null),
                                    !1;
                                $("#" + o).length ? element.progress("uploadProgress", Math.round((e + 1) / r.length * 1e4) / 100 + "%") : (window[o] = layer.open({
                                    type: 1,
                                    title: !1,
                                    skin: "chunkProgress",
                                    closeBtn: 0,
                                    area: ["420px", "auto"],
                                    content: ['<div id="' + o + '" class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="uploadProgress">', '<div class="layui-progress-bar layui-bg-blue" lay-percent="' + Math.round(e / r.length * 1e4) / 100 + '%" ></div>', "</div>"].join(""),
                                    success: function (a, e) {
                                        layer.setTop(a)
                                    }
                                }), element.render());
                                var y = admin.options[o].obj,
                                    f = (n = admin.options[o].file, admin.options[o].othis);
                                if (r[e].state = !0, layui.data(o, {
                                    key: "chunkList",
                                    value: r
                                }), e + 1 === r.length) f.data = r[e].data,
                                    f.data.action = "marge",
                                    y.upload(e, u.call(n, 0, 10), f.data.source),
                                    layui.data(o, null),
                                    delete admin.options[o].file,
                                    delete admin.options[o].files[admin.options[o].index];
                                else {
                                    f.data = r[e + 1].data;
                                    var m = (e + 1) * s,
                                        p = Math.min(m + s, n.size);
                                    y.upload(e, u.call(n, m, p), f.data.source)
                                }
                                return !1
                            }
                            200 === a.code && a.url ? (void 0 !== a.chunkId && layer.close(window[a.chunkId]), layer.msg(a.msg), c[l](a, t)) : (layer.error(a.msg), i.prop("disabled", !1))
                        }
                    })
                }))
            },
            cascader: function (a) {
                var e = [];
                a = a || "input[lay-cascader]",
                    layui.each($(a), (function (a, i) {
                        var t = $(i).val(),
                            n = $(i).attr("name"),
                            l = $(i).data("value") || "value",
                            o = $(i).data("parents") || !1;
                        void 0 !== t && t && (t = (t = t.split("/"))[t.length - 1], t = $.trim(t)),
                            e[a] = cascader({
                                elem: i,
                                value: t,
                                clearable: !0,
                                filterable: !0,
                                showAllLevels: o,
                                props: {
                                    value: l
                                },
                                options: cascader_data
                            }),
                            e[a].changeEvent((function (a, e) {
                                if (null != e) if (o) {
                                    var t = [];
                                    for (const a in e.path) {
                                        var r = e.path[a].data;
                                        t.push($.trim(r[l]))
                                    }
                                    $("#" + n).val(t.join("/"))
                                } else $(i).val(e.data[l]);
                                else $(i).val("")
                            }))
                    }))
            },
            content: function (a) {
                layui.each($("textarea[lay-editor]"), (function (a, e) {
                    let i = $(e).attr("id");
                    void 0 !== i && i || (i = "Matheditor_" + Math.round(36 * Math.random()), $(e).prop("id", i)),
                        content.tinymce(i)
                }))
            },
            markdown: function (a) {
                layui.each($("textarea[lay-markdown]"), (function (a, e) {
                    $(e).hide();
                    let i = "markdown_" + Math.round(36 * Math.random());
                    $(e).after('<div id="' + i + '"></div>'),
                        content.markdown(i, e)
                }))
            },
            tags: function (a) {
                layui.each($(".layui-tags"), (function (a, e) {
                    $(e).remove()
                })),
                    layui.each($("*[lay-tags]"), (function (a, e) {
                        layui.tags.render({
                            elem: e,
                            url: "/ajax/getTags",
                            done: function (a, e) { }
                        })
                    }))
            }
        },
        i18n.render(admin.getStorage("language") || "zh-CN");
    for (const key in admin.components) eval(admin.components[key])();
    admin.setTheme(),
        "light" === admin.getStorage("style") && $("head").append(admin.globalStyleCss()),
        $(document).on("click", (function () {
            $("span.layui-upload-clear").on("click", (function (a) {
                (a = a || window.event).stopPropagation(),
                    a.preventDefault(),
                    $(this).parents(".layui-upload-drag").find("i,p,hr").removeClass("layui-hide"),
                    $(this).parents(".layui-upload-drag").find("div").addClass("layui-hide"),
                    $(this).parents(".layui-upload-drag").find("input").prop("value", "")
            }))
        })),
        $("body").on("click", ".layui-jsonvar-add", (function (a) {
            a.stopPropagation(),
                a.preventDefault();
            var e = "<tr>";
            e += '<td><input type="text" class="layui-input" name="' + $(this).data("name") + '[key][]"></td>',
                e += '<td><input type="text" class="layui-input" name="' + $(this).data("name") + '[value][]"></td>',
                e += '<td><i class="layui-icon fa-times" onclick="layui.$(this).parents(\'tr\').remove();" ></i></td>',
                e += "</tr>",
                $(this).prev("table").find("tbody").append(e)
        })),
        form.on("radio(radioStatus)", (function (a) {
            var e = $(this).data("display");
            null != e && "undefined" !== e && (1 == a.value ? $("." + e).show() : $("." + e).hide())
        })),
        form.on("select(selectStatus)", (function (a) {
            var e = $(this).parents().prev("select"),
                i = e.data("display"),
                t = e.data("disable"),
                n = e.data("selector");
            if (void 0 === n || null == n) void 0 !== i && void 0 === t && (1 == a.value ? $("." + i).show() : $("." + i).hide()),
                void 0 !== i && void 0 !== t && (a.value == t ? $("." + i).hide() : $("." + i).show());
            else {
                n = n.replace("，", ",").split(",");
                for (let e in n) a.value !== n[e] ? $("." + n[e]).hide() : $("." + n[e]).show()
            }
        })),
        form.on("switch(switchStatus)", (function (a) {
            var e = $(this),
                i = {
                    error: function (e) {
                        $(a.elem).prop("checked", !a.elem.checked),
                            layer.error(e.msg),
                            form.render("checkbox")
                    }
                },
                t = {
                    id: $(this).attr("value"),
                    status: a.elem.checked ? 1 : 0
                };
            if ($(".bubble").length) return $(".bubble").removeClass("bubble"),
                !1;
            admin.event.request(e, t, i)
        })),
        form.on("submit(submitIframe)", (function (a) {
            var e = $(this),
                i = e.parents("form").attr("action") || !1;
            if (!1 === i || "" === i) try {
                var t = _global_.app,
                    n = _global_.action;
                i = t + "/" + _global_.controller + "/" + n
            } catch (a) { }
            if (void 0 === i) return layer.msg(i18n.prop("远程URL未定义"), "error"),
                !1;
            var l = e.data("reload") || !1;
            return e.attr("disabled", !0),
                $.post(i, a.field, (function (a) {
                    200 == a.code ? (top.layer.msg(a.msg), admin.event.closeDialog(e), !1 !== l && parent.window != top ? parent.location.reload() : parent.layui.table.cache["lay-tableList"] && parent.layui.table.reload("lay-tableList")) : top.layer.error(a.msg)
                        , void 0 !== a.data.__token__ && $("input#__token__").val(a.data.__token__)
                }), "json"),
                setTimeout((function (a) {
                    e.attr("disabled", !1)
                }), 2e3),
                !1
        })),
        form.on("submit(formSearch)", (function (a) {
            var e = a.field;
            for (const a in e) e[a] || delete e[a];
            table.reload("lay-tableList", {
                page: {
                    curr: 1
                },
                where: e
            })
        })),
        table.on("tool(lay-tableList)", (function (a) {
            var e = a.data,
                i = {},
                t = $(this).parents("table").find("tbody tr"),
                n = {
                    success: function (e) {
                        a.del(),
                            t.length - 1 != 0 && void 0 !== t.length || table.reload("lay-tableList"),
                            layer.msg(e.msg)
                    },
                    error: function (a) {
                        layer.error(a.msg)
                    }
                },
                l = $(this),
                o = l.data("title") || void 0,
                r = $(this).data("field");
            if (void 0 === r) i = {
                id: e.id
            };
            else {
                var s = r.split(",");
                for (let a in s) i[a] = e[a]
            }
            if ("edit" === a.event) admin.event.open(l, a);
            else if ("del" === a.event) {
                var d = i18n.prop("确定要执行此操作吗?请确认操作无误");
                void 0 !== o && (d += " " + o + " "),
                    layer.confirm(d, (function (a) {
                        admin.event.request(l, i, n),
                            layer.close(a)
                    }))
            } else "ajax" === a.event ? admin.event.request(l, i, n) : admin.event.open(l, a)
        })),
        $(document).on("click", "*[lay-image-click]", (function () {
            var a = $(this),
                e = a.attr("lay-image-click");
            if (0 == e.length && "img" == a[0].localName ? e = a.prop("src") : "input" == a[0].localName && (e = a.prop("value")), e) {
                console.log(e);
                layer.open({
                    title: false,
                    type: 1,
                    content: '<img style="width:100%" src="' + e + '" >'
                });
            }

        })),
        $(document).on("mouseenter", "*[lay-image-hover]", (function () {
            var a = $(this),
                e = a.attr("lay-image-hover"),
                i = '500px,auto' || void 0;
            //i = a.data("size") || void 0;
            if (0 == e.length && "img" == a[0].localName ? e = a.prop("src") : "input" == a[0].localName && (e = a.prop("value")), e) {
                var t = window.event || t,
                    n = a.width,
                    l = a.height,
                    o = t.clientX + document.body.scrollLeft + 20,
                    r = t.clientY + document.body.scrollTop + 20;
                void 0 !== i ? (i = i.split(",")).length >= 2 && (n = i[0], l = i[1]) : l <= 50 && $("<img/>").attr("src", e).load((function () { })),
                    l = Number(l);
                var s = $(window).height();
                l > s && (l = s),
                    s <= r + l && (r = s - l - 50);
                var d = '<div class="lay-images-show" style="display:none;">';
                d += '<img class="lay-images-address" src="' + e + '" width="' + n + '" height="' + l + '" ></div>',
                    $("body").append(d),
                    $(".lay-images-show").css({
                        left: o,
                        top: r,
                        display: "inline-block"
                    })
            }
        })).on("mouseleave", "*[lay-image-hover]", (function () {
            $(".lay-images-show").remove()
        })),
        //废除
        $(document).on("click", "*[lay-batch]", (function (a) {
            var e = $(this),
                i = e.data("table") || 'lay-tableList',
                g = {
                    success: function (e) {
                        table.reload("lay-tableList"),
                            layer.msg(e.msg)
                    },
                    error: function (a) {
                        layer.error(a.msg)
                    }
                },
                t = e.data("field") || void 0,
                n = ($(this).parents("body").find(".layui-table-main tbody *[data-field=id]"),
                    table.checkStatus(i));
            if (null == i) return layer.msg(i18n.prop("表格ID未定义"), "error"),
                !1;
            var l = ["id"];
            if (void 0 !== t && (l = l.concat(t.split(","))), 0 === n.data.length) return layer.msg(i18n.prop("请勾选数据"), "error"),
                !1;
            t = {};
            for (var o in l) {
                var r = l[o];
                for (var s in l[r] = [], n.data) l[r].push(n.data[s][r]);
                t[r] = l[r]
            }
            layer.confirm(i18n.prop("确定要执行此批量操作吗?请确认操作无误"), (function (a) {
                admin.event.request(e, t, g),
                    layer.close(a)
            }))
        })),
        $(document).on("click", "*[lay-open]", (function () {
            admin.event.open($(this), void 0, {})
        })),
        $(document).on("click", "*[lay-noauth]", (function () {
            var a = $(this).attr("lay-event"),
                e = admin.getConfig("router");
            if (void 0 !== typeof e.supersAdmin && !1 === e.supersAdmin && void 0 === a) throw layer.msg(i18n.prop("无权操作"), "error"),
                "没有权限"
        })),
        $(document).on("click", "*[lay-ajax]", (function (a) {
            var e = {},
                i = $(this).data("callback") || void 0,
                t = $(this).data("packet") || null,
                n = $(this).data("object") || void 0;
            if (void 0 !== n) {
                n = n.split(",");
                for (var l = 0; l < n.length; l++) {
                    let a = n[l].split(":");
                    var o = $("." + a[1]).val();
                    e[a[0]] = o
                }
            }
            "null" !== t && (t = new Function("return " + t)(), e = $.extend({},
                e, t)),
                admin.event.request($(this), e, admin.callback[i])
        })),
        $(document).keyup((function (a) {
            a.shiftKey && 80 == a.keyCode && $('[sa-event="theme"]').click()
        })),
        $(document).on("click", "*[lay-choose]", (function (a) {
            let e = $(this).attr("lay-choose") || void 0;
            layer.open({
                type: 2,
                title: i18n.prop("文件选择"),
                area: ["60%", "80%"],
                content: _global_.app + "/system.attachment/index?type=choose",
                success: function (a, i) {
                    var t = layer.getChildFrame("body", i),
                        n = '<input hidden id="chooseField" value="' + e + '" >';
                    t.append(n)
                }
            })
        })),
        layui.dropdown.render({
            elem: "#clearCache",
            data: [{
                title: "一键清理缓存",
                event: "all"
            },
            {
                title: "清理内容缓存",
                event: "content"
            },
            {
                title: "清理模板缓存",
                event: "template"
            },
            {
                title: "清理插件缓存",
                event: "plugin"
            }],
            click: function (a, e) {
                var i = layui.layer.confirm("确定要清理缓存吗？", {
                    title: "提示"
                },
                    (function () {
                        admin.event.request($("#clearCache"), {
                            type: a.event
                        }),
                            layui.layer.close(i)
                    }))
            }
        });
    var layuiside = "." + LAYSIDESHRINK + " .layui-side .layui-nav .layui-nav-item";
    $(document).on("mouseenter", layuiside + "," + layuiside + " .layui-nav-child>dd", (function () {
        if (admin.screen() >= 2) {
            var a = $(this),
                e = a.find(">.layui-nav-child");
            if (e.length > 0) a.addClass("layadmin-nav-hover"),
                e.css({
                    width: "50px",
                    top: a.offset().top,
                    left: a.offset().left + a.outerWidth()
                });
            else if ("left" === admin.getStorage("nav")) {
                if (a.hasClass("layui-nav-item")) {
                    var i = a.find("cite").text(),
                        t = a.find("a").attr("lay-href"),
                        n = '<dl id="layui-nav-child" class="layui-nav-child" >';
                    n += '<dd class="',
                        a.hasClass("layui-this") && (n += "layui-this"),
                        n += '"><a lay-href="' + t + '">' + i + "</a></dd>",
                        n += "</dl>",
                        $(a).append(n),
                        element.render("nav"),
                        a.addClass("layadmin-nav-hover"),
                        (e = a.find(">.layui-nav-child")).css({
                            width: "50px",
                            top: a.offset().top,
                            left: a.offset().left + a.outerWidth()
                        })
                }
            } else {
                var l = a.text();
                layer.tips(l, a, {
                    tips: [2, "#303133"],
                    time: -1,
                    success: function (a, e) {
                        $(a).css("margin-top", "12px")
                    }
                })
            }
        }
    })).on("mouseleave", layuiside + "," + layuiside + " .layui-nav-child>dd", (function () {
        layer.closeAll("tips");
        var a = $(this);
        a.removeClass("layadmin-nav-hover"),
            $("#layui-nav-child").remove(),
            a.find("dl").css({
                left: 0,
                top: 0
            })
    }));
    let checkChildren = function (a) {
        let e = !1;
        return layui.each(a.children, (function (a, i) {
            if (0 === i.type) return e = !0
        })),
            e
    };
    admin.getNavHtml = function (a, e = !1, i = !0) {
        let t = STR_EMPTY;
        return layui.each(a, (function (a, n) {
            checkChildren(n) ? (0 === n.pid && !n.type || !e ? t += '<li class="layui-nav-item">' : t += '<dd class="layui-nav-item hybrid-item">', t += '<a href="javascript:;">', n.icons && i && (t += '<i class="layui-icon ' + n.icons + '"></i>'), t += "<cite>" + n.title + "</cite>", t += '<i class="layui-icon layui-icon-down layui-nav-more"></i>', t += "</a>", t += '<dl class="layui-nav-child">', t += admin.getNavHtml(n.children, !0), t += "</dl>", 0 === n.pid && !n.type || !e ? t += "</li>" : t += "</dd>") : 0 === n.pid && !n.type || !e ? (t += '<li class="layui-nav-item">', t += '<a lay-href="' + n.router + '" class="layui-nav-noChild" >', n.icons && i && (t += '<i class="layui-icon ' + n.icons + '"></i>'), t += "<cite>" + n.title + "</cite>", t += "</a></li>") : n.type || (t += '<dd class="layui-nav-noChild">', t += '<a lay-href="' + n.router + '">', n.icons && (t += '<i class="layui-icon ' + n.icons + '"></i>'), t += "<cite>" + n.title + "</cite></a></dd>")
        })),
            t
    },
        admin.getTopHtml = function (a, e = !1, i = !0) {
            let t = STR_EMPTY;
            return layui.each(a, (function (a, e) {
                checkChildren(e) ? (0 !== e.pid || e.type ? t += "<dd>" : t += '<li class="layui-nav-item">', t += '<a href="javascript:;">', 0 !== e.pid && e.icons && (t += '<i class="layui-icon ' + e.icons + '" style="margin-right: 10px" ></i>'), t += e.title, 0 !== e.pid && (t += '<i class="layui-icon layui-icon-right"></i>'), t += "</a>", 0 === e.pid ? (t += '<dl class="layui-nav-child">', t += admin.getTopHtml(e.children, !0), t += "</dl>") : (t += '<dl class="layui-nav-third-child">', t += admin.getTopHtml(e.children, !0), t += "</dl>"), 0 !== e.pid || e.type ? t += "</dd>" : t += "</li>") : 0 !== e.pid || e.type ? e.type || (t += '<dd class="layui-nav-noChild">', t += '<a lay-href="' + e.router + '">', e.icons && (t += '<i class="layui-icon ' + e.icons + '" style="margin-right: 10px" ></i>'), t += e.title + "</a></dd>") : (t += '<li class="layui-nav-item">', t += '<a lay-href="' + e.router + '" >', t += e.title, t += "</a></li>")
            })),
                t
        },
        $("body").on("mouseenter", "dl.layui-nav-child dd", (function (a) {
            let e = $(this);
            e.find(">dl.layui-nav-third-child").css({
                top: 0,
                left: $(e).parents("dl").width(),
                display: "block"
            })
        })).on("mouseleave", "dl.layui-nav-child dd", (function (a) {
            $(this).find(">dl.layui-nav-third-child").hide()
        })),
        $("body").on("click", "dl.layui-nav-child dd", (function (a) {
            a.stopPropagation(),
                a.preventDefault(),
                layui.each($(".layui-nav-top .layui-this"), (function (a, e) {
                    $(e).removeClass("layui-this")
                })),
                $(this).hasClass("layui-nav-noChild") && $(this).addClass("layui-this")
        })),
        admin.getNavhybrid = function (a) {
            var e = STR_EMPTY,
                i = STR_EMPTY;
            for (let t = 0; t < a.length; t++) {
                const n = a[t],
                    l = "swift-admin-" + (t + 1);
                0 == n.pid && (e += '<li class="layui-nav-item layui-hide-xs ', 0 === t && (e += "layui-this"), e += '">', n.children ? e += '<a href="javascript:;" class="lay-nav-bind" lay-nav-bind="' + l + '" >' + n.title + "</a>" : (e += '<a href="javascript:;" data-bind="' + l + '" sa-event="tabs" data-url="' + n.router, e += '" lay-title="' + n.title + '" >' + n.title + "</a>"), e += "</li>", a[t].nav = l),
                    checkChildren(n) && (i += '<div class="' + n.nav + '"', 0 === t && (i += 'style="display:block;"'), i += ">", i += admin.getNavHtml(n.children, !1), i += "</div>")
            }
            return {
                header: e,
                navHtml: i
            }
        },
        admin.createElementTabs = function (a, e = !1) {
            var i = this.options;
            if (a.url) {
                var t = a.id || a.url,
                    n = a.url,
                    l = a.title;
                if (i.moreLabel) {
                    if (i.TabLists.length + 1 >= i.maxTabNum) return layer.msg(i18n.prop("最大打开1000个标签页")),
                        !1;
                    if ($(TABS + '>.layui-tab-title [lay-id="' + t + '"]').length >= 1) return element.tabChange(TABFILTER, t),
                        !1;
                    l = '<em class="circle"></em><span class="title">' + (l || "") + "</span>",
                        element.tabAdd(TABFILTER, {
                            id: t,
                            title: l,
                            content: '<iframe lay-id="' + n + '" src="' + n + '" frameborder="0" onload="layui.admin.removeLoading(this)" class="swiftadmin-iframe"></iframe>'
                        });
                    var o = admin.getStorage("layout") || i.layout;
                    "left" == o && admin.setBreadHtml(),
                        i.TabLists.length >= 2 && "left" === o && admin.setBreadcrumb(n, l),
                        admin.showLoading($('iframe[lay-id="' + n + '"]').parent()),
                        element.render("breadcrumb"),
                        element.tabChange(TABFILTER, t)
                } else {
                    var r = $(".swiftadmin-iframe");
                    if (void 0 === r || r.length <= 0) {
                        var s = ['<div id="swiftadmin-iframe">'];
                        s += ' <iframe lay-id="' + n + '" src="' + n + '"',
                            s += 'frameborder="0" onload="layui.admin.removeLoading(this)" class="swiftadmin-iframe"></iframe></div>',
                            $(LAYOUTADMIN + ">" + BODY).html(s)
                    } else r.attr("lay-id", n),
                        r.attr("src", n),
                        admin.setBreadcrumb(n, l);
                    admin.setBreadHtml(),
                        element.render("breadcrumb"),
                        admin.showLoading($("#swiftadmin-iframe"))
                }
                i.TabLists.push(a),
                    i.cacheTab && admin.setConfig("TabLists", i.TabLists),
                    admin.setConfig("activeTab", n)
            } else layer.msg(i18n.prop("菜单的地址不能为空"))
        },
        element.on("nav(" + MENUFILTER + ")", (function (a) {
            var e = $(this),
                i = e.attr("lay-id"),
                t = e.attr("lay-href");
            if (i || (i = t), t && "javascript:;" != t) {
                var n = e.attr("sa-title");
                n || (n = e.text().replace(/(^\s*)|(\s*$)/g, "")),
                    admin.createElementTabs({
                        id: i,
                        url: t,
                        title: n
                    },
                        !0)
            }
            admin.screen() < 2 && 0 == e.children(".layui-nav-more").length && admin.flexible()
        })),
        admin.activityTabElem = function (a) {
            var e = admin.getStorage("layout") || admin.options.layout;
            switch ($(".layui-nav li").removeClass("layui-this").removeClass("layui-nav-itemed"), $(".layui-nav li dd").removeClass("layui-this").removeClass("layui-nav-itemed"), e) {
                case "top":
                    $('.layui-nav-top [lay-href="' + a + '"]').parent("dd").addClass("layui-this");
                    break;
                case "hybrid":
                    var i = $('.layui-nav li [lay-href="' + a + '"]'),
                        t = $('.layui-nav-tree [lay-href="' + a + '"]').parents("div").attr("class");
                    void 0 !== t && ($(i).parent("li").addClass("layui-this"), $(i).parents("li").addClass("layui-nav-itemed"), $(i).parents("dd.hybrid-item").addClass("layui-nav-itemed")),
                        $("div[class^='swift-admin']").hide(),
                        $("." + t).show(),
                        i.parent("dd,li").addClass("layui-this");
                    break;
                default:
                    (i = $('.layui-nav li [lay-href="' + a + '"]')).parent("dd,li").addClass("layui-this"),
                        i.parent("dd").parents("dd,li").addClass("layui-nav-itemed");
                    break
            }
        },
        element.on("tab(" + TABFILTER + ")", (function (a) {
            var e = $(this).attr("lay-id");
            admin.activityTabElem(e);
            var i = admin.getStorage("layout") || "left";
            if ("left" === i || void 0 === i) {
                var t = $(this).children(".title").text();
                admin.options.TabLists.length >= 2 && "left" === i && admin.setBreadcrumb(e, t)
            }
            admin.rollPage("auto"),
                admin.setConfig("activeTab", e)
        })),
        element.on("tabDelete(" + TABFILTER + ")", (function (a) {
            var e = admin.options.TabLists[a.index];
            e && "object" == typeof e && (admin.options.TabLists.splice(a.index, 1), admin.options.cacheTab && admin.setConfig("TabLists", admin.options.TabLists), (e = admin.options.TabLists[a.index - 1]) && "object" == typeof e && admin.setConfig("activeTab", e.id || e.url))
        })),
        $("body").off("contextmenu").on("contextmenu", TABS + " li", (function (a) {
            var e = $(this),
                i = $(this).attr("lay-id");
            return layui.dropdown.render({
                elem: e,
                trigger: "contextmenu",
                style: "width: 110px;text-align:center;",
                id: i,
                show: !0,
                data: [{
                    title: "刷新当前",
                    id: "refresh"
                },
                {
                    title: "关闭当前",
                    id: "closeThisTabs"
                },
                {
                    title: "关闭其他",
                    id: "closeOtherTabs"
                },
                {
                    title: "关闭全部",
                    id: "closeAllTabs"
                }],
                click: function (a, e) {
                    "refresh" === a.id ? (admin.refresh(i), element.tabChange(TABFILTER, i)) : "closeThisTabs" === a.id ? admin.event.closeThisTabs(i) : "closeOtherTabs" === a.id ? admin.event.closeOtherTabs(i) : "closeAllTabs" === a.id && admin.event.closeAllTabs(i)
                }
            }),
                !1
        })),
        $(window).on("resize", (function () {
            var a = admin.getStorage("layout") || "left",
                e = $(window).width() - 550;
            admin.screen() < 2 ? (admin.flexible(), $(".layui-breadcrumb-header").hide(), $(BODYSHADECLASS).length <= 0 && $(LAYOUTADMIN).append(BODYSHADE)) : (admin.flexible("open"), $(".layui-breadcrumb-header").show(), $(BODYSHADECLASS).remove()),
                "top" !== a && "hybrid" !== a || ($(".layui-nav-head").css({
                    overflow: "hidden",
                    width: e
                }), e >= 900 && $(".layui-nav-head").css({
                    overflow: "unset"
                }))
        })),
        $("body").on("click", "*[sa-event]", (function () {
            let a = $(this).attr("sa-event"),
                e = admin.event[a];
            e && e.call(this, $(this))
        })),
        admin.BasicLayout = function (a, e = null, i = !0) {
            var t = this,
                n = t.options;
            n.TabLists = [],
                e = e || t.getConfig("router"),
                n.layout = t.getStorage("layout") || n.layout,
                n.moreLabel = t.getStorage("moreLabel"),
                void 0 === n.moreLabel && (n.moreLabel = !0),
                $(".layui-nav-head").hide(),
                $(".layui-side-menu,.layui-breadcrumb").show(),
                $(".layui-nav-top,.layui-nav-tree").html(STR_EMPTY),
                {
                    left: function (a) {
                        $(".layui-nav-tree").html(t.getNavHtml(a, !0)),
                            $(".layui-layout-left,.layui-footer," + LAYOUTADMIN + ">" + BODY).removeAttr("style")
                    },
                    top: function (a) {
                        $(".layui-side-menu").hide(),
                            $(".layui-breadcrumb").hide(),
                            $(".layui-nav-head").show(),
                            $(".layui-nav-top").html(t.getTopHtml(a, !0, !1)),
                            $(".layui-layout-left,.layui-footer," + LAYOUTADMIN + ">" + BODY).css("left", "0")
                    },
                    hybrid: function (a) {
                        $(".layui-breadcrumb").hide(),
                            $(".layui-nav-head").show();
                        var e = admin.getNavhybrid(a);
                        $(".layui-nav-top").html(e.header),
                            $(".layui-nav-tree").html(e.navHtml),
                            $(".layui-layout-left,.layui-footer," + LAYOUTADMIN + ">" + BODY).removeAttr("style"),
                            $("a.lay-nav-bind").on("click", (function (a) {
                                var e = $(this).attr("lay-nav-bind");
                                void 0 !== e && ($("div[class^='swift-admin']").hide(), $("." + e).show())
                            }))
                    }
                }[n.layout](e.authorities);
            n.moreLabel && i ? ($(BODY).html('<div class="layui-tab" lay-allowClose="true" lay-filter="swiftadmin-tabs">       <ul class="layui-tab-title"></ul>          <div class="layui-tab-content"></div>   </div> <div id="tabs-control">   <div class="layui-icon swiftadmin-tabs-control layui-icon-left" sa-event="leftPage"></div>   <div class="layui-icon swiftadmin-tabs-control layui-icon-right" sa-event="rightPage"></div>   <div class="layui-icon swiftadmin-tabs-control layui-icon-down">      <ul class="layui-nav swiftadmin-tabs-select " lay-filter="swiftadmin-nav">         <li class="layui-nav-item" lay-unselect>            <a></a>            <dl class="layui-nav-child layui-anim-fadein">               <dd sa-event="closeThisTabs" lay-unselect><a>关闭当前标签页</a></dd>               <dd sa-event="closeOtherTabs" lay-unselect><a>关闭其它标签页</a></dd>               <dd sa-event="closeAllTabs" lay-unselect><a>关闭全部标签页</a></dd>            </dl>         </li>      </ul>   </div> </div>'), $(BODY).find(".layui-tab-content").css("top", "40px")) : n.moreLabel || $(BODY).find(".layui-tab-content").css("top", "0px");
            var l = admin.getConfig("TabLists");
            void 0 === l && (l = n.TabLists);
            var o = admin.getConfig("activeTab");
            if (i) if (l.length) if (n.moreLabel) for (let a in l) admin.createElementTabs({
                id: l[a].id,
                url: l[a].url,
                title: l[a].title
            });
            else admin.createElementTabs({
                id: l[l.length - 1].id,
                url: l[l.length - 1].url,
                title: l[l.length - 1].title
            });
            else void 0 === a.id && (a.id = a.url),
                admin.createElementTabs({
                    id: a.id,
                    title: a.title,
                    url: a.url
                });
            element.render("nav"),
                element.tabChange(TABFILTER, o)
        },
        admin.reloadLayout = function () {
            let a = this;
            console.log(a.options.authorizeUrl);
            $.ajax({
                type: "get",
                url: a.options.authorizeUrl,
                success: function (e) {
                    try {
                        e = "object" != typeof e ? JSON.parse(e) : e
                    } catch (a) { }
                    a.setConfig("router", e),
                        a.BasicLayout(null, e, !1)
                },
                error: function (a) {
                    $(LAYOUTADMIN).html(a.responseText)
                }
            })
        },
        admin.render = function (a, e) {
            let i = this;
            this.options = $.extend(this.options, e),
                this.options.layout = this.getStorage("layout") || this.options.layout,
                $(LAYOUTBODY).children("#loading").length || $(LAYOUTBODY).append(admin.getSpinningHtml()),
                admin.screen() < 2 && admin.flexible(),
                i.options.authorizeUrl = $("#authorize").data("url"),
                $.ajax({
                    type: "get",
                    url: i.options.authorizeUrl,
                    success: function (e) {
                        console.log(e);
                        try {
                            e = "object" != typeof e ? JSON.parse(e) : e
                        } catch (a) { }
                        i.setConfig("router", e),
                            i.BasicLayout(a, e),
                            admin.removeLoading("master")
                    },
                    error: function (a) {
                        admin.removeLoading("master"),
                            $(LAYOUTADMIN).html(a.responseText)
                    }
                })
        },
        exports("admin", admin)
}));